package com.niuwa.p2p.action.customerservice;

import java.util.List;
import java.util.Map;

import org.apache.struts2.convention.annotation.Action;
import org.springframework.beans.factory.annotation.Autowired;

import com.niuwa.p2p.action.JsonAction;
import com.niuwa.p2p.core.mvc.entity.PageBean;
import com.niuwa.p2p.entity.custservice.CustServiceGroup;
import com.niuwa.p2p.entity.custservice.CustServiceGroupMember;
import com.niuwa.p2p.service.custService.ICustGroupService;
import com.opensymphony.xwork2.ActionContext;

public class ServiceGroupAction extends JsonAction {

	private static final long serialVersionUID = -164220153058789615L;
	
	@Autowired
	private ICustGroupService groupService;
	
	/** 小组编号 */
	private long groupId;
	
	/** 小组成员信息 */
	private List<CustServiceGroupMember> groupMembers;
	
 	
 	public List<CustServiceGroupMember> getGroupMembers() {
		return groupMembers;
	}

	public void setGroupMembers(List<CustServiceGroupMember> groupMembers) {
		this.groupMembers = groupMembers;
	}

	public long getGroupId() {
		return groupId;
	}

	public void setGroupId(long groupId) {
		this.groupId = groupId;
	}

	/**
 	 * 跳转到客服小组页面
 	 * @return
 	 */
 	@Action("gotoGroupServiceList")
	public String gotoGroupServiceList() {
 		
		return "serviceGroupList";
	}
 	
 	/**
	 * 获取全部小组信息
	 * @return
	 */
	@Action("groupServiceList")
	public String getOBGroup(){
		// 获取查询参数
		Map<String, Object> paramMap = getParamMap();
		// 执行查询操作
		PageBean<CustServiceGroup> pagination = groupService.selectAllGroup(paramMap);
		setObjectReSult(pagination);
		return NONE;
	}
	
	/**
	 * 编辑小组信息
	 * @return
	 */
	@Action("gotoUpdateGroupMemberPage")
	public String gotoUpdateGroupMemberPage(){
		ActionContext context = ActionContext.getContext();
		groupMembers = groupService.selectGroupMemberByGroupId(groupId);
		context.put("groupMembers", groupMembers);
		return "updateGroupMember";
	}
 	
	
}
